<template>
    <section id="container" class="visitors-index">
        <!--header start-->
        <header class="header fixed-top clearfix">
            <!--logo start-->
            <div class="brand">
                <router-link to="/" class="logo"> {{ config.title }} </router-link>
                <div class="sidebar-toggle-box">
                    <div class="fa fa-bars" @click="hideSidebar=!hideSidebar"></div>
                </div>
            </div>
            <!--logo end-->
            <div class="nav notify-row" id="top_menu">
                <!--  notification start -->
                <ul class="nav top-menu">
                    <!-- settings start -->
                    <li>
                        <router-link to="/" style="border-radius: 5px">
                            <i class="fa fa-home"></i>
                            网站首页
                        </router-link>
                    </li>


                    <li v-if="$session.cx == '用户'">
                        <e-chat-button>消息</e-chat-button>
                    </li>


                </ul>
                <!--  notification end -->
            </div>
            <div class="top-nav clearfix">
                <!--search & user info start-->
                <ul class="nav pull-right top-menu">
                    <li style="padding-top: 6px">权限：{{ $session.cx }}</li>

                    <!-- user login dropdown start-->
                    <li class="dropdown">
                        <el-popover>
                            <template #reference>
                                <a data-toggle="dropdown" class="dropdown" href="javascript:;">
                                    <img alt="" v-if="!$session.touxiang" src="@/assets/2.png" />
                                    <e-img alt="" v-else :src="$session.touxiang" />
                                    <span class="username"> {{ $session.username }} </span>
                                    <b class="fa fa-angle-down"></b>
                                </a>
                            </template>
                            <ul class="dropdown-menu extended logout">
                                <li>
                                    <router-link to="/index"><i class="fa fa-home"></i>网站主页</router-link>
                                </li>
                                <li>
                                    <a href="javascript:;" @click="logout"><i class="fa fa-key"></i>退出</a>
                                </li>
                            </ul>
                        </el-popover>
                    </li>
                    <!-- user login dropdown end -->
                </ul>
                <!--search & user info end-->
            </div>
        </header>
        <!--header end-->
        <!--sidebar start-->
        <aside>
            <div id="sidebar" class="nav-collapse" :class="{'hide-left-bar':hideSidebar}">
                <!-- sidebar menu start-->
                <div class="leftside-navigation">
                    <ul class="sidebar-menu" id="nav-accordion">
                        <li class="sub-menu" :class="{active:k == active}" v-for="(m,k) in menus">
                            <a href="javascript:;" @click="active= active == k ? -1 : k">
                                <i class="fa fa-angle-right"></i>
                                <span>{{ m.label }}</span>
                                <span class="dcjq-icon"></span>
                            </a>
                            <ul class="sub">
                                <li v-for="c in m.children"><router-link :to="c.to" active-class="active">{{ c.label }}</router-link></li>
                            </ul>
                        </li>
                    </ul>
                </div>
                <!-- sidebar menu end-->
            </div>
        </aside>
        <!--sidebar end-->
        <!--main content start-->
        <section id="main-content" :class="{'merge-left':hideSidebar}">
            <router-view></router-view>
            <!-- / footer -->
        </section>
        <!--main content end-->
    </section>
</template>
<style type="type/scss" lang="scss">
    .visitors-index {
        width: 100%;
        height: 100%;
        font-family: "微软雅黑", "Microsoft YaHei", "Roboto", sans-serif;
        overflow-x: hidden;
        background: url(@/assets/bg.jpg) no-repeat 0px 0px;
        background-size: cover;
        .header {
            left: 0;
            right: 0;
            z-index: 1002;
            background: rgb(240, 188, 180);
            -webkit-transition: all 0.3s ease-in-out;
            -moz-transition: all 0.3s ease-in-out;
            -o-transition: all 0.3s ease-in-out;
            transition: all 0.3s ease-in-out;
        }
        .fixed-top {
            position: fixed;
            box-shadow: 1px 0 3px rgba(0, 0, 0, 0.15);
        }
        .hide-left-bar {
            margin-left: -240px !important;
            -webkit-transition: all 0.3s ease-in-out;
            -moz-transition: all 0.3s ease-in-out;
            -o-transition: all 0.3s ease-in-out;
            transition: all 0.3s ease-in-out;
        }
        .merge-left {
            margin-left: 0px !important;
            left: 10px !important;
        }
        .wrapper {
            display: inline-block;
            margin-top: 80px;
            padding: 15px;
            width: 100%;
        }
        .brand {
            background: #8b5c7e;
            float: left;
            width: 240px;
            height: 80px;
            position: relative;
        }
        a.logo {
            font-size: 14px;
            color: #fff;
            word-wrap: break-word;
            float: left;
            margin: 20px 0 0 25px;
            text-transform: uppercase;
        }
        a.logo:hover,
        a.logo:focus {
            text-decoration: none;
            outline: none;
        }

        a.logo span {
            color: #FF6C60;
        }

        #top_menu .nav > li,
        ul.top-menu > li {
            float: left;
        }

        .notify-row {
            float: left;
            margin-top: 30px;
            margin-left: 25px;
        }

        ul.top-menu {
            margin-right: 15px;
            margin-top: 0;
        }

        ul.top-menu > li > a {
            color: #fff;
            font-size: 16px;
            background: #8b5c7e;
            padding: 4px 8px;
            margin-right: 15px;
            border-radius: 50%;
            -webkit-border-radius: 50%;
            padding-right: 8px !important;
        }

        ul.top-menu > li > a:hover,
        ul.top-menu > li > a:focus {
            background: #fa9fa4;
            text-decoration: none;
            color: #fff !important;
            padding-right: 8px !important;
        }

        .nav .open > a,
        .nav .open > a:focus,
        .nav .open > a:hover {
            background: #fa9fa4 !important;
            color: #fff !important;
        }

        .top-nav {
            margin-top: 20px;
        }

        .top-nav img {
            border-radius: 50%;
            -webkit-border-radius: 50%;
            width: 33px;
        }

        .top-nav .icon-user i {
            height: 33px;
            width: 33px;
            line-height: 33px;
            display: inline-block;
            font-size: 1.7em;
            padding-left: 10px;
        }

        .top-nav .icon-user .username {
            color: #555555;
            font-size: 13px;
            position: relative;
            top: -5px;
        }

        .top-nav .icon-user .caret {
            position: relative;
            top: -4px;
        }
        .sidebar-toggle-box {
            float: left;
            margin-top: 23px;
            margin-left: -15px;
            background: #8b5c7e;
            border-radius: 50%;
            -webkit-border-radius: 50%;
            width: 32px;
            height: 32px;
            text-align: center;
            position: absolute;
            right: -15px;
            .fa-bars {
                cursor: pointer;
                display: inline-block;
                font-size: 15px;
                padding: 8px 8px 8px 9px;
                color: #fff;
            }
        }
        .top-nav .username {
            font-size: 13px;
            color: #fff;
        }
        .top-nav b {
            font-size: 13px;
            color: #fff;
        }
        .top-nav ul.top-menu > li .dropdown {
            display: inline-block;
            border-radius: 100px;
            -webkit-border-radius: 100px;
            padding: 3px 12px 5px 10px;
            background: none;
            margin-right: 0;
            border: 1px solid #8b5c7e;
            background: #8b5c7e;
        }

        .top-nav ul.top-menu > li {
            margin-left: 10px;
        }

        .top-nav ul.top-menu > li .dropdown:hover,
        .top-nav ul.top-menu > li .dropdown:focus {
            border: 1px solid #fa9fa4;
            background: #fa9fa4 !important;
            border-radius: 100px;
            -webkit-border-radius: 100px;
            text-decoration: none;
        }

        .top-nav .nav .caret {
            border-bottom-color: #A4AABA;
            border-top-color: #A4AABA;
        }

        .top-nav ul.top-menu > li > a:hover .caret {
            border-bottom-color: #000;
            border-top-color: #000;
        }

        .dcjq-icon {
            height: 17px;
            width: 17px;
            display: inline-block;
            background: url(@/assets/nav-expand.png) no-repeat top;
            border-radius: 3px;
            -moz-border-radius: 3px;
            -webkit-border-radius: 3px;
            position: absolute;
            right: 10px;
        }

        .active .dcjq-icon {
            background: url(@/assets/nav-expand.png) no-repeat bottom;
            border-radius: 3px;
            -moz-border-radius: 3px;
            -webkit-border-radius: 3px;
        }

        #sidebar {
            width: 240px;
            height: 100%;
            position: fixed;
            background: rgba(52, 48, 48, 0.78);
            -webkit-transition: all 0.3s ease-in-out;
            -moz-transition: all 0.3s ease-in-out;
            -o-transition: all 0.3s ease-in-out;
            transition: all 0.3s ease-in-out;
        }

        #sidebar ul li {
            position: relative;
        }

        .leftside-navigation,
        .right-stat-bar {
            height: 100%;
            overflow-y: auto;

            &::-webkit-scrollbar {
                /*滚动条整体样式*/
                width: 10px; /*高宽分别对应横竖滚动条的尺寸*/
                height: 1px;
            }

            &::-webkit-scrollbar-thumb {
                /*滚动条里面小方块*/
                border-radius: 10px;
                -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
                background: #535353;
            }

            &::-webkit-scrollbar-track {
                /*滚动条里面轨道*/
                -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
                border-radius: 10px;
                background: #EDEDED;
            }
        }

        .nav-collapse.collapse {
            display: inline;
        }

        ul.sidebar-menu,
        ul.sidebar-menu li ul.sub {
            margin: -2px 0 0;
            padding: 0;
        }

        ul.sidebar-menu {
            padding-top: 80px;
        }

        ul.sidebar-menu > li > ul.sub {
            display: none;
        }

        #sidebar .sub-menu > .sub li a {
            padding-left: 46px;
        }

        ul.sidebar-menu > li.active > ul.sub,
        #sidebar > ul > li > ul.sub > li > a {
            display: block;
        }

        ul.sidebar-menu li ul.sub li {
            background: rgba(52, 48, 48, 0);
            margin-bottom: 0;
            margin-left: 0;
            margin-right: 0;
        }

        ul.sidebar-menu li ul.sub li a {
            font-size: 12px;
            padding-top: 13px;
            padding-bottom: 13px;
            -webkit-transition: all 0.3s ease;
            -moz-transition: all 0.3s ease;
            -o-transition: all 0.3s ease;
            -ms-transition: all 0.3s ease;
            transition: all 0.3s ease;
            color: #fff;
        }

        ul.sidebar-menu li ul.sub li a:hover,
        ul.sidebar-menu li ul.sub li.active a {
            color: #fff;
            -webkit-transition: all 0.3s ease;
            -moz-transition: all 0.3s ease;
            -o-transition: all 0.3s ease;
            -ms-transition: all 0.3s ease;
            transition: all 0.3s ease;
            display: block;
            background: rgba(40, 40, 46, 0.28);
        }

        ul.sidebar-menu li {
            border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        }

        ul.sidebar-menu li.sub-menu {
            line-height: 15px;
        }

        ul.sidebar-menu ul.sub li {
            border-bottom: none;
        }

        ul.sidebar-menu li a span {
            display: inline-block;
        }

        ul.sidebar-menu li a {
            color: #fff;
            text-decoration: none;
            display: block;
            padding: 18px 0 18px 25px;
            font-size: 12px;
            outline: none;
            -webkit-transition: all 0.3s ease;
            -moz-transition: all 0.3s ease;
            -o-transition: all 0.3s ease;
            -ms-transition: all 0.3s ease;
            transition: all 0.3s ease;
        }

        ul.sidebar-menu li a.active,
        ul.sidebar-menu li a:hover,
        ul.sidebar-menu li a:focus {
            background: rgba(40, 40, 46, 0.28);
            color: #fff;
            display: block;
            -webkit-transition: all 0.3s ease;
            -moz-transition: all 0.3s ease;
            -o-transition: all 0.3s ease;
            -ms-transition: all 0.3s ease;
            transition: all 0.3s ease;
        }

        ul.sidebar-menu li a i {
            font-size: 15px;
            padding-right: 6px;
        }

        ul.sidebar-menu li a:hover i,
        ul.sidebar-menu li a:focus i {
            color: #fff;
        }

        ul.sidebar-menu li a.active i {
            color: #fff;
        }

        .mail-info,
        .mail-info:hover {
            margin: -3px 6px 0 0;
            font-size: 11px;
        }

        #main-content {
            position: fixed;
            left: 260px;
            top: 90px;
            right: 0px;
            bottom: 10px;
            padding-right: 15px;
            overflow: hidden;
            overflow-y: auto;
            /*margin-left:240px;*/
            -webkit-transition: all 0.3s ease-in-out;
            -moz-transition: all 0.3s ease-in-out;
            -o-transition: all 0.3s ease-in-out;
            transition: all 0.3s ease-in-out;
            .el-card {
                /*background: rgba(255,255,255,.5);*/
                box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.3);
                .el-card__header {
                    > div {
                        &:before {
                            content: ">>>>";
                            color: #DEDEDE;
                        }
                    }

                    padding: 10px 20px;
                    background: #ffffff;
                }
                .el-button--mini {
                    padding: 7px 10px;
                }
                .form-search {
                    background: #dcdcdc;
                    .el-form-item {
                        margin-bottom: 0px;
                    }
                }
            }
        }

        #main-content iframe {
            display: block;
            width: 100%;
            height: 100%;
            overflow: hidden;
            overflow-y: auto;
            border: none;
            scrollbar-face-color: #ff0198; /*滚动条凸出部分的颜色*/
            scrollbar-highlight-color: #ff0198; /*滚动条空白部分的颜色 */
            scrollbar-shadow-color: #ff0000; /*立体滚动条阴影的颜色 */
            scrollbar-3dlight-color: #ff0198; /*滚动条亮边的颜色 */
            scrollbar-arrow-color: #ffffff; /*上下按钮上三角箭头的颜色*/
            scrollbar-track-color: #ffffff; /*滚动条的背景颜色 */
            scrollbar-base-color: #ff0198; /*滚动条的基本颜色 */
        }

        #main-content iframe::-webkit-scrollbar {
            width: 5px;
            height: 5px;
        }

        /* 滚动槽 */
        #main-content iframe::-webkit-scrollbar-track {
            /*-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);*/
            background: #dce5f0;
            border-radius: 10px;
            width: 10px;
        }

        /* 滚动条滑块 */
        #main-content iframe::-webkit-scrollbar-thumb {
            border-radius: 2px;
            background: #2c6daa;
            -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.5);
        }

        #main-content iframe::-webkit-scrollbar-thumb:window-inactive {
            background: #2c6daa;
        }
    }

    .dropdown-menu.logout {
        width: 170px !important;
        li {
            height: 30px;
            line-height: 30px;
            overflow: hidden;
            border-bottom: 1px solid #dedede;
            a {
                color: #1a1a1a;
                display: block;
                > i {
                    display: inline-block;
                    margin-right: 10px;
                    color: #DEDEDE;
                }
            }
            a:hover {
                text-decoration: none;
            }
        }
        li:last-child {
            border-bottom: none;
        }
    }

    @media (min-width: 480px) and (max-width: 767px) {
        .header {
            position: relative !important;
            margin-top: 80px !important;
        }
        .merge-header {
            margin-right: 0px !important;
        }
        .brand {
            width: 100%;
            float: none;
            position: fixed;
            top: 0px;
            z-index: 1005;
        }
        .sidebar-toggle-box {
            right: 10px;
        }
        .top-nav {
            margin-bottom: 20px;
        }
        .top-menu {
            margin-right: 10px;
        }
        .wrapper {
            margin-top: 0px;
        }
        ul.sidebar-menu {
            margin-top: 0px;
        }
        #sidebar {
            position: fixed !important;
            z-index: 1002;
            top: 80px;
        }
        #main-content {
            margin-left: 0px;
        }
    }
    @media (max-width: 767px) {
        .fixed-width #container,
        .fixed-width #container .header {
            width: 100%;
        }

        #sidebar {
            margin-left: -240px;
            -webkit-transition: all 0.3s ease-in-out;
            -moz-transition: all 0.3s ease-in-out;
            -o-transition: all 0.3s ease-in-out;
            transition: all 0.3s ease-in-out;
        }
        .hide-left-bar {
            margin-left: 0px !important;
        }
        ul.sidebar-menu {
            padding-top: 0px;
        }
        /*-*/
        .prd-row .action {
            right: 25px;
        }
        .lock-wrapper {
            padding: 0 20px;
        }
        .lock-wrapper img {
            width: 140px;
            height: 140px;
            margin-top: 10px;
        }
        .lock-pwd input {
            width: 70%;
        }

        #time {
            font-size: 100px;
        }

        .media-gal .item {
            width: 100%;
        }
        .media-filter {
            margin: 25px 0;
        }

        .media-filter + .pull-right,
        .media-filter + .pull-right + .btn {
            float: left !important;
        }
    }
    @media (max-width: 479px) {
        .header {
            position: relative !important;
        }
        .merge-header {
            margin-right: 0px !important;
        }
        .brand {
            width: 100%;
            float: none;
            position: fixed;
            top: 0px;
            z-index: 1005;
        }
        .sidebar-toggle-box {
            right: 10px;
        }
        .top-nav {
            margin-bottom: 20px;
        }
        .top-menu {
            margin-right: 10px;
        }
        .wrapper {
            margin-top: 0px;
        }
        ul.sidebar-menu {
            margin-top: 0px;
        }
        #sidebar {
            position: fixed !important;
            z-index: 1002;
            top: 80px;
        }
        #main-content {
            margin-left: 0px;
        }
        .notify-row {
            float: none;
        }
    }
</style>
<script>
    import config from "@/config";
    import { logout } from "@/utils/utils";
    import menu from "@/views/admin/sidebar";

    export default {
        name: "visitors-index",
        data() {
            return {
                config,
                active: 0,
                menus: [],
                hideSidebar: false,
            };
        },
        watch: {},
        computed: {},
        methods: {
            logout,
        },
        created() {
            menu.getMenus().then((res) => {
                this.menus = res;
            });
        },
        mounted() {},
        destroyed() {},
    };
</script>
